Threats like the one in Leviticus, tap into the fears of members of early civilisations. Famine, attacks by wild animals, natural disasters, disease etc, were real fears, just like they are today, except we understand the cause wasn't angry, displeased spirits.
A society that believed they lived and died at the whim of god(s) bred radical, superstitious behaviour with barbarous punishments, which we have inherited. Those behaviours are hard to shake off.
Something like disfellowshipping is directly related to these early beliefs.